﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DelegateDemo1
{
    public delegate int Transformer(int x);

    class Util
    {
        public static void Transform(int[] values, Transformer t)
        {
            for (int i = 0; i < values.Length; i++)
            {
                values[i] = t(values[i]);
            }
        }
    }
    public class Program
    {
        static int Square(int x) => x * x;
        static void Main(string[] args)
        {
            int[] values = {1,2,3 };
            Util.Transform(values,Square);
            foreach (var i in values)
            {
                Console.WriteLine($"{i}");
            }
            Console.Read();
        }
    }
}
